package com.hzdl.car.mapper;

import com.hzdl.car.bean.News;
import com.hzdl.car.sqlprovider.NewsSqlProvider;
import com.hzdl.car.vo.NewsVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NewsMapper {
    @SelectProvider(type = NewsSqlProvider.class ,method = "findNews")
    List<News> findNews(NewsVo newsVo);
    @Insert("insert into sys_news (title,content,createTime,publisherName) " +
            "values (#{title},#{content},now(),#{publisherName})")
    int addNews(NewsVo newsVo);
    @Delete("delete from sys_news where id=#{id}")
    int dekNews(NewsVo newsVo);
    @Update("update sys_news set title=#{title},content=#{content} where id=#{id}")
    int newsUpdate(NewsVo newsVo);
    @Select("select * from sys_news order by createTime desc limit 0,5")
    List<News> showNews();
}
